<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('用户选择')" />
</head>
<style>
	body{height:auto;font-family: "Microsoft YaHei";}
	button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
</style>
<body class="hold-transition box box-main">
	<input id="tableId"   name="tableId"    type="hidden" th:value="${user.userId}"/>
	<input id="tableName" name="tableName"  type="hidden" th:value="${user.userName}"/>
	<div class="wrapper">
		<div class="col-sm-12 search-collapse">
			<form id="user-search-form">
				<!--<input type="hidden" id="userId" name="userId" th:value="${user.userId}">-->
				<div class="select-list">
					<ul>
						<li>
							姓名：<input type="text" name="userName"/>
						</li>
						<li>
							手机号码：<input type="text" name="phonenumber"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>
		<div class="container-div">
			<div class="row">
				<div class="col-sm-12 select-table table-striped">
					<table id="bootstrap-table"></table>
				</div>
			</div>
		</div>
		<div th:include="include :: footer"></div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
        var prefix = ctx + "system/user";
        var datas = [[${@dict.getType('sys_normal_disable')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                showRefresh: true,
                showToggle: true,
                showColumns: false,
                singleSelect: true,//是否单选
                clickToSelect:true,//设置单击选中行
                rememberSelected: true,//启用翻页记住前面的选择
                columns: [{
                    checkbox: true
                },
                    {
                        field : 'userId',
                        title : '用户ID'
                    },
                    {
                        field : 'userCode',
                        title : '用户编号'
                    },
                    {
                        field : 'userName',
                        title : '用户姓名'
                    },
                    {
                        field : 'userPhone',
                        title : '用户手机'
                    },
                    {
                        field: 'status',
                        title: '用户状态',
                        align: 'center',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(datas, value);
                        }
                    }],
                onCheck: zOnClick,
                onPostBody: onPostBody
            };
            $.table.init(options);
        });

        function zOnClick(row, $element) {
            var treeId = row.userId;
            var treeName = row.userName;
            $("#tableId").val(treeId);
            $("#tableName").val(treeName);
        }
        function onPostBody (data) {
            console.log(data);
		}
	</script>
</body>
</html>
